package day230412;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/4/13 15:10
 * 模拟洗牌
 */
public class Main01 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int group = scan.nextInt(); // 输入数据组数
        while (group-- != 0) {
            int n = scan.nextInt();
            int k = scan.nextInt();
            int[] board = new int[2 * n];
            for (int i = 0; i < board.length; i++) {
                board[i] = scan.nextInt();
            }
            // 模拟洗牌过程并打印结果
            shuffle(board, n, k);
        }
        scan.close();
    }

    // 模拟 k 次洗牌
    private static void shuffle(int[] board, int n, int k) {
        // 1 2 3 4 5 6
        // 左手 1 2 3
        // 右手 4 5 6  => 洗牌一次后 1 4 2 5 3 6
        while(k-- != 0) {
            int[] newBoard = new int[board.length]; // 存储每次洗好的牌
            for (int i = 0; i < n; i++) {
                newBoard[2 * i] = board[i]; // 左手牌
                newBoard[2 * i + 1] = board[i + n]; // 右手牌
            }
            // 更新左右手的牌
            board = Arrays.copyOf(newBoard, board.length);
        }
        // 打印牌的结果
        printMyBoard(board);
    }

    // 打印牌面
    private static void printMyBoard(int[] board) {
        System.out.print(board[0]);
        for (int i = 1; i < board.length; i++) {
            System.out.print(" " + board[i]);
        }
        System.out.println();
    }
}
